import { http } from "@/utils/http";
import { Result } from "../types";

export type dictData = {
  Id?: number;
  ParentId: number;
  Name: string;
  Code: string | number;
  Sequence: number;
  Status: number;
  Value: string;
  Note: string;
};

// 字典列表
export const DictTreeList = () => {
  return http.request<Result>("get", "/api/Dict/DictTreeList", {});
};

// 新增字典
export const addDict = (data: dictData) => {
  return http.request<Result>("post", "/api/Dict/Add", { data });
};

// 修改字典
export const updateDict = (data: dictData) => {
  return http.request<Result>("post", `/api/Dict/Update/${data.Id}`, { data });
};

// 删除字典
export const delDict = (Id: number) => {
  return http.request<Result>("post", `/api/Dict/Delete/${Id}`, {});
};

// 型号
export const agvModels = () => {
  return http.request<Result>("post", `/api/Dict/ListByParentCode/`, {});
};